home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / SpriteWorld 2.2 Extra Demos / User Contributions / ButtonBreakOut ƒ / SpritePersistence / SpritePersistence.h < prev    next >
Encoding:
Text File  |  1999-01-11  |  4.6 KB  |  106 lines  |  [TEXT/CWIE]

  1. // SpritePersistence.h
  2.  
  3. #ifndef __SPRITEPERSISTENCE_
  4. #define __SPRITEPERSISTENCE_
  5.  
  6.  
  7. ///©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©
  8. //                                            PUBLIC
  9. ///©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©
  10.  
  11. ///≈≈≈≈≈≈≈≈    Public data ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
  12.  
  13.             // ******************************************************************************
  14.             // *** tSpriteSaveRec is to be changed depending on the data you want to save ***
  15.             // ******************************************************************************
  16. typedef struct tSpriteSaveRec
  17.         {
  18.             SInt16        hz;                                                // sprite's coords
  19.             SInt16        vt;                                                // ''
  20.             SInt32        userDataExample;                                // just another example
  21.         }
  22.             tSpriteSaveRec,    * tSpriteSavePtr, ** tSpriteSaveHandle;
  23.  
  24.             // ******************************************************************************
  25.             // *** kMaxSpritesInOneLayer must be >= the max number of sprites in the most ***
  26.             // *** populated layer which you are going to save. It is only used for          ***
  27.             // *** computing resource ID values (see the FAQs for info about this value)  ***
  28.             // ******************************************************************************
  29. #define        kMaxSpritesInOneLayer                200                        // change this if you use more
  30.  
  31.             // NOTE: currently, SpritePersistence overrides DataPersistence's resource type
  32. #define        kSpriteSaveRezType                    'SPRI'                    // change this if you like
  33.  
  34.             // NOTE: currently, this module does not set it's own file: uses the standard data file
  35. //#define    kSpriteSaveFileName                    "\pSprite Persistence"    // (change this if you like)
  36.  
  37.             // NOTE: currently, the file type and creator are not used
  38. //#define    kSpriteSaveFileType                    'SPRI'                    // (change this if you like)
  39. //#define    kSpriteSaveFileCreator                '????'                    // (change this if you like)
  40.  
  41.  
  42. ///≈≈≈≈≈≈≈≈    Public prototypes ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
  43.  
  44.             // ****************************************************************************
  45.             // *** The following two routines are to be changed for your application.    ***
  46.             // *** They are called, respectively, just before writing to disk, and        ***
  47.             // *** just after having read a sprite record from disk.                     ***
  48.             // ****************************************************************************
  49. void        SWGCopyFromSpriteToRecord (SpritePtr spriteP, tSpriteSaveHandle recordHandle);
  50. void        SWGCopyFromRecordToSprite (tSpriteSaveHandle recordHandle, SpritePtr spriteP);
  51.  
  52.             // ****************************************************************************
  53.             // *** The following routine may to be changed for your application.        ***
  54.             // ****************************************************************************
  55. SInt16        SWGComputeResourceID (SInt16 layerNum, SInt16 spriteNum, SpritePtr spriteP);
  56.  
  57.             // Other public prototypes (and macros); they shouldn't need to be adapted
  58.  
  59. #define        SWGSaveSpritesInAllLayers(x)        SWGDoSpritesInAllLayers (x, true)
  60. #define        SWGLoadSpritesInAllLayers(x)        SWGDoSpritesInAllLayers (x, false)
  61.  
  62. #define        SWGSaveSpritesInLayer(x)            SWGDoSpritesInLayer (x, true)
  63. #define        SWGLoadSpritesInLayer(x)            SWGDoSpritesInLayer (x, false)
  64.  
  65. #define        SWGSaveSingleSprite (x,y,z)            SWGDoSingleSprite (x, y, z, true)
  66. #define        SWGLoadSingleSprite (x,y,z)            SWGDoSingleSprite (x, y, z, false)
  67.  
  68. SInt16         SWGGetLayerNumber (SpriteLayerPtr spriteLayerP);
  69. SInt16         SWGGetSpriteNumber (SpritePtr spriteP);
  70.  
  71.             // Called through the 6 SWGSave/Load macros above => must be made public
  72.  
  73. OSErr        SWGDoSpritesInAllLayers (SpriteWorldPtr spriteWorldP, Boolean write);
  74. OSErr         SWGDoSpritesInLayer (SpriteLayerPtr spriteLayerP, Boolean write);
  75. OSErr         SWGDoSingleSprite (SInt16 layerNum, SInt16 spriteNum, SpritePtr spriteP, Boolean write);
  76.  
  77.  
  78. ///©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©
  79. //                                            PRIVATE
  80. ///©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©
  81.  
  82. #ifdef OWNER
  83.  
  84. ///≈≈≈≈≈≈≈≈    Private data ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
  85.  
  86. Boolean        gSWGSpriteSaveFileIsOpen                = false;
  87. Boolean        gSWGSpriteSaveIntoApp                    = false;
  88. SInt16        gSWGCurrentResFile                        = -1;
  89. SInt16        gSWGSaveResFile                            = -1;
  90.  
  91. Handle        gSWGBufferHandle                        = nil;
  92.  
  93.  
  94. ///≈≈≈≈≈≈≈≈    Private prototypes ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
  95.  
  96. OSErr         _SWGSaveSingleSprite (SInt16 layerNum, SInt16 spriteNum, SpritePtr spriteP);
  97. OSErr         _SWGLoadSingleSprite (SInt16 layerNum, SInt16 spriteNum, SpritePtr spriteP);
  98. OSErr        _SWGCreateBufferHandle (void);
  99.  
  100.  
  101. #endif         // OWNER
  102.  
  103. #endif        // __SPRITEPERSISTENCE_
  104.  
  105. // end
  106.